<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="http://www.51xuecheng.cn/static/img/asset-favicon.ico">
    <title>登录</title>
    <link rel="stylesheet" href="http://www.51xuecheng.cn/static/plugins/normalize-css/normalize.css" />
    <link rel="stylesheet" href="http://www.51xuecheng.cn/static/plugins/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="http://www.51xuecheng.cn/static/css/page-learing-sign.css" />
    <script src="http://www.51xuecheng.cn/static/js/wxlogin.js"></script>
</head>

<body>
<!-- 页面头部 -->
<!--#include virtual="/include/header.html"-->
    <!-- 页面 -->
    <div id="loginarea" class="register">
        <!--<img src="../../assets/img/logoico.png" alt="logo" width="200">-->

        <div class="register-body container text-center">
            <div class="signTit cl"><span class="sign activ" style="width:100px">扫码登录</span><span ><a href="http://www.51xuecheng.cn/register.html">注册</a></span></div>
            <div class="signItem show" id="login_container">
                
            </div>
           
        </div>
<!--底部版权-->
<!--#include virtual="/include/footer.html"-->
    </div>
    <!-- 页面 css js -->
    <script type="text/javascript" src="/plugins/jquery/dist/jquery.js"></script>
    <script type="text/javascript" src="/plugins/bootstrap/dist/js/bootstrap.js"></script>
    <script src="/static/js/page-learing-sign.js"></script>
<script>

  //请用微信生成二维码
  function generateWxQrcode(token) {
      var wxObj = new WxLogin({
          self_redirect: true,
          id: "login_container",
          appid: "wxed9954c01bb89b47",
          scope: "snsapi_login",
          //redirect_uri: "http://tjxt-user-t.itheima.net/api/auth/wxLogin",
          redirect_uri: "http://localhost:8160/auth/wxLogin",
          state: token,
          style: "",
          href: ""
      });
  }

     var loginVm= new Vue({  
            el: "#loginarea", 
            data: {
              usernamejson:{
                 username:'',
                  password:'',
                  checkcode:'',
                  checkcodekey:'',
                  authType:'password'
              },
              formdata:{
                  username:'',
                  grant_type:'password',
                  client_secret:'XcWebApp',
                  client_id:'XcWebApp'
              },
              autologin:false,
              checkcode_img:''

            },
            methods: {
            //   login(){
            //       //转json串
            //       let usernameJson = JSON.stringify(this.usernamejson)
            //       console.log(usernameJson)
            //       this.formdata.username = usernameJson;
            //       let params = querystringify(this.formdata);
            //        loginSubmit(params).then(res=>{
            //             console.log(res)
            //             if(res&& res.access_token){

            //                 if(this.autologin){
            //                     setCookie('jwt',res.access_token,30)
            //                 }else{
            //                     setCookie('jwt',res.access_token,0)
            //                 }
                            
            //                 this.$message.success('登录成功')
            //                 setInterval("window.location='/'",2000)
            //             }

            //       }).catch(error=>{
            //         if(error&&error.response&&error.response.data&&error.response.data.error_description){
            //             this.$message.error(error.response.data.error_description)
            //         }
            //         this.getCheckCode();
            //       })
    
            //   },
              getCheckCode(){
                getCheckCodeSubmit().then(res=>{
                    //console.log(res)
                      if(res&&res.key){
                        generateWxQrcode(res.key);
                      }
              })
             }
          },
            created() {
                this.getCheckCode()
            },
            mounted(){
               
            }
          })
</script>
</body>
